<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>组件属性</title>
  <link rel="shortcut icon" href="image/amtf-ml.ico">
  <script type="text/javascript" src="./js/polyfill.js"></script>

</head>
<script type="text/javascript">
  window.onerror = function (errorMsg, url, lineNumber) {
      alert('Error: ' + errorMsg + '\n Script: ' + url + '\n Line: ' + lineNumber);
  };
</script>
<script  type="text/javascript" src="./js/clipboard.min.js"></script>

<!-- <script src="./js/vue.global.js"></script> -->

<body>
  <!--案例一：从另一元素复制文本：通过data-clipboard-target在触发器中添加属性来实现-->
  <input type="text" id="input">
  <button id="copy" data-clipboard-target="#input">复制input框中的内容</button>
  <textarea name="" id="" cols="30" rows="10"></textarea>


  </body>

  <script type="text/javascript">
   var clipboard = new ClipboardJS('#copy')
   // 显示用户反馈/捕获复制/剪切操作后选择的内容
   clipboard.on('success', function (e) {
    console.info('Action:', e.action)//触发的动作/如：copy,cut等
    console.info('Text:', e.text);//触发的文本
    console.info('Trigger:', e.trigger);//触发的DOm元素
    e.clearSelection();//清除选中样式（蓝色）
   })
   clipboard.on('error', function (e) {
    console.error('Action:', e.action);
    console.error('Trigger:', e.trigger);
   });

  </script>


</html>
